package com.onlineMIS.ORM.entity.headQ.finance;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;

import com.onlineMIS.common.Common_util;
import com.onlineMIS.common.ExcelTemplate;
import com.onlineMIS.common.loggerLocal;

public class FinanceCategoryTemplate extends ExcelTemplate {

	public static final DecimalFormat df = new DecimalFormat("#.00");

	private final int date_row_ind = 1;
	private final int data_row_ind = 1;

	private List<FinanceCategoryVO> list = new ArrayList<FinanceCategoryVO>();

	public FinanceCategoryTemplate(String templateWorkbookPath,List<FinanceCategoryVO> list) throws IOException {
		super(templateWorkbookPath);
		this.list = list;

	}

	public HSSFWorkbook process() {
		HSSFSheet sheet = templateWorkbook.getSheetAt(0);

		for (int i = 0; i < list.size(); i++) {
			FinanceCategoryVO item = list.get(i);
			Row row = sheet.createRow(i + data_row_ind);
			row.createCell(0).setCellValue(item.getItemName());	
			row.createCell(1).setCellValue(item.getAcumulateAmt()); 
			row.createCell(2).setCellValue(item.getStatusS()); 
			row.createCell(3).setCellValue(item.getBelongTos()); 
			row.createCell(4).setCellValue(item.getTransferAccounts()); 
			row.createCell(5).setCellValue(item.getCreateBy()); 
			row.createCell(6).setCellValue(item.getCreateDate());
			row.createCell(7).setCellValue(item.getComment());			
		}
		return templateWorkbook;
	}

}
